package com.yangjiayu.utils;

import com.yangjiayu.service.DocumentService;
import org.springframework.ai.transformer.splitter.TextSplitter;
import org.springframework.context.annotation.Bean;

import java.util.List;

/**
 * @Classname CustomTextSpliter
 * @Description TODO
 * @Date 2025/8/15 06:20
 * @Created by YangJiaYu
 */
public class CustomTextSpliter extends TextSplitter {


    @Override
    protected List<String> splitText(String text) {
        // (?=\RQ：)  正向预查：遇到“Q：”就切，但保留“Q：”
        return List.of(text.split("(?=\\RQ：)"));
    }

//    @Override
//    protected List<String> splitText(String text) {
//        return List.of(split(text));
//    }
//
//    public String[] split(String text) {
//        return text.split("\\s*\\R\\s*\\R\\s*");
//    }
}
